'\" te
.\" Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 1989 AT&T
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH DIR_UFS 5 "Apr 16, 2003"
.SH NAME
dir_ufs, dir \- format of ufs directories
.SH SYNOPSIS
.LP
.nf
\fB#include <sys/param.h>\fR
.fi

.LP
.nf
\fB#include <sys/types.h>\fR
.fi

.LP
.nf
\fB#include <sys/fs/ufs_fsdir.h>\fR
.fi

.SH DESCRIPTION
.sp
.LP
A directory consists of some number of blocks of \fBDIRBLKSIZ\fR bytes, where
\fBDIRBLKSIZ\fR is chosen such that it can be transferred to disk in a single
atomic operation, for example, 512 bytes on most machines.
.sp
.LP
Each  \fBDIRBLKSIZ\fR-byte block contains some number of directory entry
structures, which are of variable length.  Each directory entry has a
\fBstruct direct\fR at the front of it, containing its inode number, the length
of the entry, and the length of the name contained in the entry.  These entries
are followed by the name padded to a 4 byte boundary with null bytes.  All
names are guaranteed null-terminated. The maximum length of a name in a
directory is  \fBMAXNAMLEN\fR.
.sp
.in +2
.nf
#define DIRBLKSIZ                       DEV_BSIZE
#define MAXNAMLEN                       256
struct direct {
        ulong_t  d_ino;                 /* inode number of entry */
        ushort_t d_reclen;              /* length of this record */
        ushort_t d_namlen;              /* length of string in d_name */
        char     d_name[MAXNAMLEN + 1]; /* maximum name length */
};
.fi
.in -2

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for a description of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Unstable
.TE

.SH SEE ALSO
.sp
.LP
.BR ufs (4FS),
.BR attributes (7)
